
<template>
    <div class="btn-router" :style="bStyle">
      <span :style="bpStyle">
        <slot></slot>
      </span>
    </div>
</template>
<script>
export default {
  data () {
    return {
    }
  },
  props: {
    right: {
      type: String,
      default: '0.5rem'
    },
    top: {
      type: String,
      default: '0rem'
    },
    color: {
      type: String,
      default: '#fff'
    },
    size: {
      type: String,
      default: '18'
    },
    background: {
      type: String,
      default: ''
    },
    backgroundColor: {
      type: String,
      default: 'transparent'
    },
    width: {
      type: Number,
      default: 300
    },
    height: {
      type: Number,
      default:110// eslint-disable-line
    }
  },
  computed: {
    bStyle () {
      return {
        background: 'url(' + this.background + ') no-repeat top left', // eslint-disable-line
        backgroundSize: 'contain',
        backgroundColor: this.backgroundColor,
        color: this.color,
        fontSize: this.size + 'px',
        width: (this.width / 100) + 'rem',
        height: (this.height / 100) + 'rem'
      }
    },
    bpStyle () {
      if (this.background) {
        return {
          position: 'absolute',
          display: 'block',
          lineHeight: (this.height / 100) + 'rem',
          right: this.right,
          top: this.top,
          width: '100%',
          textAlign: 'center'
        }
      } else {
        return {
          position: 'relative',
          display: 'block',
          lineHeight: (this.height / 100) + 'rem',
          textAlign: 'center'
        }
      }
    }
  }
}
</script>

<style>
  .btn-router{
    background-size: contain !important;
    position: relative;
    text-align: center;
  }

</style>
